package com.xmu.prcs.debugutil;

import com.xmu.prcs.action.bean.PlantInfoBean;
import com.xmu.prcs.action.bean.UserInfoBean;

/**
 * 调试工具类
 * 
 * @author frequent
 * 
 */
public class DebugUtil {

	/**
	 * 是否显示调试信息
	 */
	public static boolean isDebugShow = true;

	public static void printUserInfo(UserInfoBean user) {
		if (isDebugShow) {
			System.out.println("+++++++++++++++UserInfoBean+++++++++++++++");
			if (user.getAddress() != null) {
				System.out.println("address: " + user.getAddress());
			}
			if (user.getBirthday() != null) {
				System.out.println("Birthday: " + user.getBirthday());
			}
			if (user.getEmail() != null) {
				System.out.println("Email: " + user.getEmail());
			}
			if (user.getName() != null) {
				System.out.println("Name: " + user.getName());
			}
			if (user.getPassword() != null) {
				System.out.println("Password: " + user.getPassword());
			}
			if (user.getQqNumber() != null) {
				System.out.println("QqNumber: " + user.getQqNumber());
			}
			if (user.getSex() != null) {
				System.out.println("Sex: " + user.getSex());
			}
			if (user.getSignature() != null) {
				System.out.println("Signature: " + user.getSignature());
			}
			if(user.getZip() != null){
				System.out.println("zip: " + user.getZip());
			}
			System.out.println("++++++++++++++++++++++++++++++++++++++++++++");
		}
	}

	public static void printPlantInfo(PlantInfoBean plant) {
		if (isDebugShow) {
			System.out
					.println("++++++++++++++++++plant info+++++++++++++++++++++");
			if (plant.getAlias() != null) {
				System.out.println("alias: " + plant.getAlias());
			}
			if (plant.getApplication() != null) {
				System.out.println("Application: " + plant.getApplication());
			}
			if (plant.getCampus() != null) {
				System.out.println("Campus: " + plant.getCampus());
			}
			if (plant.getCharacteristic() != null) {
				System.out.println("Characteristic: "
						+ plant.getCharacteristic());
			}
			if (plant.getCulture() != null) {
				System.out.println("Culture: " + plant.getCulture());
			}
			if (plant.getEnglishName() != null) {
				System.out.println("EnglishName: " + plant.getEnglishName());
			}
			if (plant.getGrowPoint() != null) {
				System.out.println("GrowPoint: " + plant.getGrowPoint());
			}
			if (plant.getHabits() != null) {
				System.out.println("Habits: " + plant.getHabits());
			}
			if (plant.getKindKe() != null) {
				System.out.println("KindKe: " + plant.getKindKe());
			}
			if (plant.getKindShu() != null) {
				System.out.println("KindShu: " + plant.getKindShu());
			}
			if (plant.getOriginPlace() != null) {
				System.out.println("OriginPlace: " + plant.getOriginPlace());
			}
			if (plant.getPlantName() != null) {
				System.out.println("PlantName: " + plant.getPlantName());
			}
			if (plant.getScientificName() != null) {
				System.out.println("ScientificName: "
						+ plant.getScientificName());
			}
			if (plant.getSubject() != null) {
				System.out.println("Subject: " + plant.getSubject());
			}
			if (plant.getLongitude() != null) {
				System.out.print("longitude:");
				for (int i = 0; i < plant.getLongitude().size(); i++) {
					System.out.println(plant.getLongitude().get(i) + ", ");
				}
				System.out.println();
			}
			System.out
					.println("++++++++++++++++++++++++++++++++++++++++++++++++");
		}
	}
}
